{include file="common/head"}
<head>
<title>员工信息编辑</title>

<style type="">
  label{width: 18%;}
  .form-control{display:inline-block;width: 80%;}  
</style>
</head>
<body style="">
    <div class="container p-3 my-3 " style="max-width: 600px;"  >
    <h2>员工信息编辑 【工号:{$data.uid}】</h2>
    <form method="post" enctype="multipart/form-data" action="/index.php/user/edit">

      <input type="hidden" name="id" id="id" value="{$data.id}" />
      <div class="mb-3 mt-3">
        <label for="dept_id" class="form-label">部门:</label>
        <select id="dept_id" name="dept_id" class="form-control">
            {foreach $dept as $k=>$v}
                {if $k==$data.dept_id}
                    <option value="{$k}" selected >{$v['name']}</option>
                {else}
                    <option value="{$k}" >{$v['name']}</option>
                {/if}
            {/foreach}
        </select>
      </div>
<!--       <div class="mb-3 mt-3">
        <label for="level" class="form-label">职务级别:</label>
        <select id="level" name="level" class="form-control">
            {foreach $levels as $k=>$v}
                {if $k==$data.level}
                    <option value="{$k}" selected >{$v}</option>
                {else}
                    <option value="{$k}" >{$v}</option>
                {/if}
            {/foreach}
        </select>
      </div>    -->

      <!--平台管理员，人事部门才能更改员工权限-->
      {if $me['group_id']<3} 
      <div class="mb-3 mt-3">
        <label for="group_id" class="form-label">权限组:</label>
        <select id="group_id" name="group_id" class="form-control">
            {foreach $group as $k=>$v}
                {if $k==$data.group_id}
                    <option value="{$k}" selected >{$v['name']}</option>
                {else}
                    <option value="{$k}" >{$v['name']}</option>
                {/if}
            {/foreach}
        </select>
      </div>
      {/if}

<hr/>
      <div class="mb-3 mt-3">
        <!-- <label for="name" class="form-label">工号:</label> -->
        <input type="hidden" class="form-control" id="uid" name="uid" value="{$data.uid}" placeholder="工号(登录帐号)" disabled />
      </div>
      <div class="mb-3">
        <label for="title" class="form-label">登录账号:</label>
        <input type="text" class="form-control" id="uid" name="uid" value="{$data.uid}" placeholder="登录账号" />
      </div>
      <div class="mb-3">
        <label for="title" class="form-label">姓名:</label>
        <input type="text" class="form-control" id="name" name="name" value="{$data.name}" placeholder="姓名" />
      </div>
      <div class="mb-3">
        <label for="id_card" class="form-label">身份证号码:</label>
        <input type="text" class="form-control" id="id_card" name="id_card" value="{$data.id_card}" placeholder="身份证号码" />
      </div>      
      <div class="mb-3">
        <label for="mobile" class="form-label">手机号码:</label>
        <input type="text" class="form-control" id="mobile" name="mobile" value="{$data.mobile}" placeholder="Mobile" />
      </div>
      <div class="mb-3">
        <label for="wx" class="form-label">微信:</label>
        <input type="text" class="form-control" id="wx" name="wx" value="{$data.wx}" placeholder="wx/facebook" />
      </div>   
       
      <div class="mb-3">
        <label for="address" class="form-label">居住地址:</label>
        <input type="text" class="form-control" id="address" name="address" value="{$data.address}" placeholder="居住地址" />
      </div>        

      <div class="mb-3">
        <label for="sex" class="form-label">性别:</label>
          <input type="radio" class="form-check-input" id="radio1" name="sex" value="1" {if $data.sex==1} checked {/if}/> 
          <label class="form-check-label" for="radio1">男士</label>
          <input type="radio" class="form-check-input" id="radio2" name="sex" value="2" {if $data.sex==2} checked {/if}/>
          <label class="form-check-label" for="radio2">女士</label>
      </div>

      <div class="mb-3">
        <label for="status" class="form-label">是否在职:</label>
          <input type="radio" class="form-check-input" id="radio3" name="status" value="1" {if $data.status==1} checked {/if}/> 
          <label class="form-check-label" for="radio3">在职</label>
          <input type="radio" class="form-check-input" id="radio4" name="status" value="2" {if $data.status==2} checked {/if}/>
          <label class="form-check-label" for="radio4">离职</label>
          <input type="radio" class="form-check-input" id="radio5" name="status" value="3" {if $data.status==3} checked {/if}/>
          <label class="form-check-label" for="radio5">黑名单</label>          
       </div>

      <div class="mb-3">
        <img src="{$data.image}" style="width: 140px;"/><br />
        <label for="file" class="form-label">上传图片(Image):</label>
        <input type="file"  name="file" /> <br> 
      </div>   
      <button  type="button" class="btn btn-primary" onclick="doSave()">保存员工资料</button>

    </form>
    </div>

<script type="text/javascript">
    function doSave(){
      if(!$("#name").val()) {
        layer.msg("无效的名称(Invalid name)!");
        return 0;
      }    
      //询问框
      layer.confirm('是否确定保存?', {
        btn: ['YES','CANCEL'] //按钮
      }, function(){
        $('form').submit();
      }, function(){
        layer.msg("Cancel!");
        return 0;
      });
    }

</script>


</body>
</html>
